package dao.impl;


import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import vo.Log;
import vo.Student;
import dao.UserDao;
@Repository("sd")
public class UserDaoImpl implements UserDao {
	@PersistenceContext(name="un")
	private EntityManager em;
	@Override
	public List<Log> findLog() {
		String jpql="select l from log l";
		List<Log> ls=em.createQuery(jpql).getResultList();
		if(ls.isEmpty()) return null;
		else return ls;
	}
	@Override
	public int addLog(Log logs) {
		em.persist(logs);
		return logs.getId();
	}
          
	
	
	
	
	
	/*@Override
	public int addStu(Student s) {
		em.persist(s);
		return s.getId();
	}
		
	@Override
	public Student findStu(String uname, String psd) {
		
		String jpql="select s from Students s where s.uname=:uname and s.psd=:psd";
		List<Student> ls=em.createQuery(jpql)
				.setParameter("uname", uname)
				.setParameter("psd", psd)
				.getResultList();
		if(ls.isEmpty()) return null;
		else return ls.get(0);
		
	}*/


}
